<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>后台管理系统-登录</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css" href="../static/css/style.css"  />
<link rel="stylesheet" type="text/css" href="../static/css/login.css"  />
<link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css"  />
<!-- <link rel="icon" type="image/x-icon" href="../static/imgs/favicon.ico">-->
<style>
     /*body{height:100%;background: #e2e2e2;overflow:hidden;}*/
     canvas{z-index:-1;position:absolute;}
     ::-webkit-input-placeholder {
      color: black;
     }
      dd{
       margin: 20px 1px;
      }
</style>

</head>
<body onkeydown="keyLogin();">
<div class="main">
 <dl class="admin_login" style="width: 480px;height: 320px">
  <dt style="color: white">
   <strong ><img src="../static/imgs/favicon.ico" width="25px" height="25px"> 后台管理系统</strong>
   <em style="font-size: 16px;">Management System</em>
  </dt>
  <dd class="user_icon" style="margin-bottom: 15px">
   <input type="text" id="username" placeholder="账号" class="login_txtbx"/>
  </dd>
  <dd class="pwd_icon" style="margin-bottom: 15px">
   <input type="password" id="pwd" placeholder="密码" class="login_txtbx"/>
  </dd>
  <dd class="val_icon" style="margin-bottom: 15px">
   <div class="checkcode" >
    <input type="text" id="J_codetext" placeholder="验证码" maxlength="4"
           class="login_txtbx" style="width: 130px"
    >
    <canvas class="J_codeimg" id="myCanvas"  style="width: 240px;margin-left: 80px;background-color:#014d6d"
            onclick="createCode()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas>
   </div>
   <!--<input  type="button" value="点此获取验证码"  class="layui-btn" onClick="validate(); "
           style="padding: 2px;width: 220px;background-color:#72acff;height: 42px;margin-left: 77px ">-->
  </dd>
  <dd style="margin-top: 20px">
   <input type="button" value="立即登录" class="submit_btn" style="background-color:#014d6d "/>
  </dd>
  <dd>
  </dd>
 </dl>
</div>
<script src="../static/js/zoneCommonJs/jquery.min.js" ></script>
<script src="../static/js/zoneCommonJs/jquery.cookie.js" ></script>
<script src="../static/js/login/verificationNumbers.js" ></script>
<script src="https://www.jq22.com/jquery/three.min.js"></script>
<script src="../static/js/login/ground.js"></script>
<script src="../static/layui/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer;
        //验证码
        createCode();
        $(".submit_btn").click(function(){
            // location.href="javascrpt:;"/*tpa=http://***index.html*/;
            if($("#username").val().length<=0){
                layer.msg("请输入用户名");
            }else if($("#pwd").val().length<=0){
                layer.msg("请输入密码");
            }else if(yzcode(layer)) {//验证二维码  (/*yzcode(layer)*/)
                $.ajax({
                    url:"/login/loginIn",
                    data:{username:$("#username").val(),password:$("#pwd").val()},
                    type:"post",
                    success:function (result) {
                        var user=result.data;
                        if(result.code==0){
                            $.cookie('adminId',user.id);
                            $.cookie('username',user.username);
                            $.cookie('roleid',user.roleId);
                            $.cookie('role',user.role.name);
                            window.location.href="index.html";
                        }else {
                            layer.msg(result.message);
                        }
                    }
                });
            }

        });
    });
    //enter提交
    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
            $(".submit_btn").click();
    }

</script>
</body>
</html>
